Learn R Programming

hablar (version 0.3.2)

math ignore NA in math funs: Ignore NA in math

Description

Simplifying math functions are simple wrappers of math function (- +). If any of the left-hand side or right-hand side is NA, Inf or NaN it returns any rational value, if there is any.

However, if the both values are irrational it returns NA. The result is then passed to the corresponding math function.

Usage

.x %minus_% .y

.x %plus_% .y

Value

a single value

Arguments

.x

numeric or integer element

.y

numeric or integer element

See Also

vignette("s"), vignette("hablar")

Examples

Run this code
if (FALSE) # The simplest case
3 %minus_% 2

# But with NA it returns 3 as if the NA were zero
3 %minus_% NA

# It doesnt matter if the irrational number is on left- or right-hand.
NA %plus_% 5


Run the code above in your browser using DataLab